package zkclient.dwj.cn;

import org.I0Itec.zkclient.ZkClient;
import org.I0Itec.zkclient.serialize.SerializableSerializer;
import org.apache.zookeeper.CreateMode;

/**
 * Created by Administrator on 2017/11/13 0013.
 */
public class CreateNode {
        public static void main(String[] args) {
        ZkClient zc = new ZkClient("192.168.110.134:2181", 10000, 10000, new SerializableSerializer());
        System.out.println("connect ok");
        User u = new User();
        u.setId(1);
        u.setName("dwj");
        String path = zc.create("/dwj", u, CreateMode.PERSISTENT);
        System.out.println("create path : " + path);
    }
}
